<?php
namespace BWL\webshopBundle\DataFixtures\ORM;
/**
 * Created by JetBrains PhpStorm.
 * User: leon
 * Date: 11/19/12
 * Time: 10:04 PM
 * To change this template use File | Settings | File Templates.
 */


use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\AbstractFixture;
use BWL\webshopBundle\Entity\Role;

class RoleFixtures extends AbstractFixture implements OrderedFixtureInterface
{
  public function load(ObjectManager $manager)
  {
    $roleAdmin = new Role();
    $roleAdmin->setName('ROLE_ADMIN');
    $manager->persist($roleAdmin);

    $roleUser = new Role();
    $roleUser->setName('ROLE_USER');
    $manager->persist($roleUser);


    $manager->flush();

    // Save references
    $this->addReference('roleUser', $roleUser);
    $this->addReference('roleAdmin', $roleAdmin);
  }

  /**
   * Insertion order
   * @return int
   */
  public function getOrder() {
    return 2;
  }
}
